package com.gxsyh.nantie.refund.management.provider.service.impl;

import com.gxsyh.nantie.refund.management.provider.domain.TbRefund;
import com.gxsyh.nantie.refund.management.provider.mapper.TbRefundMapper;
import com.gxsyh.nantie.refund.management.provider.service.TbRefundService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

@Service
public class TbRefundServiceImpl implements TbRefundService {

    @Resource
    private TbRefundMapper tbRefundMapper;


    @Override
    public int updateTbUserRefundStatus(Long id, int refundStatus) {
        Example example=new Example(TbRefund.class);
        example.createCriteria().andEqualTo("id",id);
        TbRefund tbRefund=new TbRefund();
        tbRefund.setRefundStatus(refundStatus);
        return tbRefundMapper.updateByExampleSelective(tbRefund,example);
    }

    @Override
    public int updateTbUserRefundInfo(Long id, String refundInfo,int refundStatus) {
        Example example=new Example(TbRefund.class);
        example.createCriteria().andEqualTo("id",id);
        TbRefund tbRefund=new TbRefund();
        tbRefund.setRefundInfo(refundInfo);
        tbRefund.setRefundStatus(refundStatus);
        return tbRefundMapper.updateByExampleSelective(tbRefund,example);
    }
}
